<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>对象</title>
	<script type="text/javascript">
		
		// 对象：属性与方法的集合体
		
		// 对象构造器
		function ArrObj() {
			this.push = function (arr,num) {
				arr[arr.length] = num;
				return arr;
			}
			this.unshift = function (arr,num) {
				tempArr = [];
				tempArr[0] = num;

				for (var i = 0; i <arr.length; i++) {
					tempArr[i+1] = arr[i];
				}

				return tempArr;
			}
			this.pop = function (arr) {
				tempArr = [];

				for (var i = 0; i < arr.length-1; i++) {
					tempArr[i] = arr[i]
				}

				return tempArr;
			}
		}



		obj = new ArrObj();

		console.log(obj);

		// res = obj.push([2,2,2],90);

		// res = obj.unshift([2,2,2],90);

		// document.write(res);









	</script>
</head>
<body>
	
</body>
</html>